/*
 * 版权：Copyright (c) 2019 红网
 * 
 * 创建日期：Wednesday March 13th 2019
 * 创建者：胡燕龙(huyl) - y.dragon.hu@hotmail.com
 * 
 * 修改日期: Wednesday, 13th March 2019 11:02:33 am
 * 修改者: 胡燕龙(huyl) - y.dragon.hu@hotmail.com
 * 
 * 说明
 * 		1、工业互联网管理应用
 */
import { addon, Ref, ISecurityService, } from "pao-aop";
import { ReactApplication, AppReactRouterControl, Authentication, updateTheme } from "pao-aop-client";
import { IndustryInternetSignAppStorage } from "./appStorage";
import { IUserService } from "src/business/models/user";
import { ICompanyTemplateSignService } from "src/models/companySign";
import { theme_default } from "../style/theme";
export let mainApplication: IndustryInternetSignApplication;

/**
 * 控件：工业互联网管理应用
 */
@addon('IndustryInternetSignApplication', '工业互联网管理应用', '工业互联网管理应用')
export class IndustryInternetSignApplication extends ReactApplication {
    /**
     * 工业互联网管理应用
     * @param router 路由配置
     * @param securityService_Fac 安全服务
     */
    constructor(
        router?: Ref<AppReactRouterControl>,
        securityService_Fac?: Ref<ISecurityService>,
        public userService_Fac?: Ref<IUserService>,
        public companyTemplateSignService_Fac?: Ref<ICompanyTemplateSignService>) {
        super(router, securityService_Fac);
    }

    run?() {
        super.run!();
        mainApplication = this;
    }

    protected onAppBeforeStart?() {
        // 初始化全局数据事件方法
        Authentication.handleGlobalDataEvent = IndustryInternetSignAppStorage.handleGlobalDataEvent;
        IndustryInternetSignAppStorage.userService_Fac = this.userService_Fac;
        IndustryInternetSignAppStorage.companyTemplateSignService_Fac = this.companyTemplateSignService_Fac;
        // 初始化主题
        updateTheme(theme_default);
    }
}
